package cn.edu.tju.se.auth.service;

import cn.edu.tju.se.auth.enity.Customer;
import cn.edu.tju.se.auth.repository.CustomRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomService {

    @Autowired
    private CustomRepository customRepository;

    public void addCustomer(Customer customer){
        customRepository.save(customer);
    }

    public void deleteCustomer(Customer customer){
        customRepository.delete(customer);
    }

    public List<?> getAllCustomers(){
        return customRepository.findAll();
    }

    public List<Customer> findByusername(String username) {
        return customRepository.findByusername(username);
    }

    public List<?> getCustomListScore(String username){
        return customRepository.findListScore(username);
    }

    public Integer getCustomIntegerScore(String username){
        return customRepository.findIntegerScore(username);
    }

    public Customer getCustomer(String username){
        return customRepository.findCustomerByusername(username);
    }
}
